import java.util.*;
	import java.io.*;
	import edu.vanderbilt.isis.sm.*; 
	public class AnchorcellReader implements IDataReader {
	private TopLevelAnchorcell.REGION_T.STATE_T state;
	private IDataProvider dataProvider;
	private IDataPrinter dataPrinter;
	public AnchorcellReader (TopLevelAnchorcell.REGION_T.STATE_T state, IDataProvider dataProvider, IDataPrinter dataPrinter) {
		this.state = state;
		this.dataProvider = dataProvider;
		this.dataPrinter = dataPrinter;
		this.dataProvider.setHasEvents(3, 4);
	}
	// Implemented from IDataReader for custom inputting 
	public void setInput() {
		ArrayList<String> inputs = new ArrayList<String>();
		for (int i=0; i < 3; i++) {
			inputs.add(dataProvider.readData());
		}
		dataProvider.advance();
		if (inputs.size() == 3) { // A little error-checking
			int val_0 = Integer.parseInt(inputs.get(0));;
			int val_1 = Integer.parseInt(inputs.get(1));;
			int val_2 = Integer.parseInt(inputs.get(2));;
		state.setData( val_0,  val_1,  val_2 );
		}
	}
	public void writeOutput() {
		ArrayList<String> outputs = new ArrayList<String>();
		System.out.println("Value of ISd0 is: " + state.ISd0);
		outputs.add("" + state.ISd0);
		System.out.println("Value of ISd1 is: " + state.ISd1);
		outputs.add("" + state.ISd1);
		System.out.println("Value of ISd2 is: " + state.ISd2);
		outputs.add("" + state.ISd2);
		System.out.println("Value of ISd3 is: " + state.ISd3);
		outputs.add("" + state.ISd3);
		if (dataPrinter != null){
			dataPrinter.writeData(outputs);
			dataProvider.advance();
		}
	}
	public boolean hasData() {
		return this.dataProvider.hasData();
	}
	public String readEvent() {
		return this.dataProvider.readEvent();
	}
};